<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div id="name">{{username}}
    <p>cont的值是{{count}}</p>
    <button v-on:click="add">+1</button>
    <button v-on:click="sub">-1</button>
</div>
<script src="lib/vue-2.6.12.js"></script>
<script>

    const vm=new Vue({
        el:'#name',
        data:{
            username:'sb',
            count:0
        },
        methods:{
            add:function (){
                vm.count+=1
            },
            sub:function (){
                vm.count-=1
            }
        }
    })
</script>
</body>
</html>